#ifndef XML_TAG_DEFINE
#define XML_TAG_DEFINE

#include <string>
#include <deque>
#include "status.h"

using namespace std;


// File type
#define		FILE_TYPE_VIDEO					"video"
#define		FILE_TYPE_AUDIO					"audio"
#define		FILE_TYPE_DOCUMENT				"document"
#define		FILE_TYPE_IMAGE					"image"
#define		FILE_TYPE_BINARY				"binary"
#define		FILE_TYPE_HTML					"html"

class BaseXMLInterface
{
protected:
	string m_LatestSaved;
public:
	virtual bool Load(const char * pBuf) = 0;
	virtual const char * Save() = 0;
};

class ShareFolderListXML : public BaseXMLInterface
{
public:
	struct ShareFolderItem
	{
		wstring name;
		wstring path;
	};
	std::deque<ShareFolderItem> List;
	void Reset()
	{
		List.clear();
	}
	bool Load(const char * pBuf);
	const char * Save();
};

class ShareFolderXML : public BaseXMLInterface
{
public:
	struct ShareItem
	{
		std::wstring	name;
		std::string		type;
		std::string		filetype;
		std::wstring	path;		// No need to save to XML
		void Reset()
		{
			name.clear();
			type.clear();
			filetype.clear();
		}
	};

	void Reset()
	{
		ShareItems.clear();
	}
	std::wstring ShareFolderPath;
	std::deque<ShareItem> ShareItems;

	bool Load(const char * pBuf);
	const char * Save();
};

class ServerStatusXML : public BaseXMLInterface
{
public:
	CServerStatus m_ServerStatus;
	void Reset()
	{
		m_ServerStatus.Reset();
	}
	bool Load(const char * pBuf);
	const char * Save();
};

class LoginResponseXML : public BaseXMLInterface
{
public:
	bool m_bLogin;
	bool Load(const char * pBuf);
	const char * Save();
};

class LogoutResponseXML : public BaseXMLInterface
{
public:
	bool m_bLogout;
	bool Load(const char * pBuf);
	const char * Save();
};

class AddFolderResponseXML : public BaseXMLInterface
{
public:
	bool m_bAdd;
	bool Load(const char * pBuf);
	const char * Save();
};

class RemoveFolderResponseXML : public BaseXMLInterface
{
public:
	bool m_bRemoved;
	bool Load(const char * pBuf);
	const char * Save();
};

#endif